package com.salmon.study.fail;


import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.actor.Props;

public class FailureHandlingMain {

    public static void main(String[] args) throws Exception {
        //当child actor发生异常时（throws an exception or an unhandled exception bubbles out from receive）
        //默认情况父actor会重启这个supervised actor。
        ActorSystem system = ActorSystem.create("testSystem");
        ActorRef supervisingActor = system.actorOf(Props.create(SupervisingActor.class), "supervising-actor");
        supervisingActor.tell("failChild", ActorRef.noSender());
        Thread.sleep(1000);
        system.terminate();
    }

}
